﻿using System.Data.Entity;

namespace Coticula.Web.Models
{
    public class CoticulaDbContext: DbContext
    {
        public DbSet<Solutions> Solutions { get; set; }
        public DbSet<Results> Results { get; set; }
        public DbSet<Languages> Languages { get; set; }
        public DbSet<Verdicts> Verdicts { get; set; }
        public DbSet<Problems> Problems { get; set; }
        public DbSet<TestsResults> TestsResultses { get; set; }
        public DbSet<SpecificData> SpecificDatas { get; set; }
        public DbSet<CompiledDetails> CompiledDetails { get; set; } 

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //modelBuilder.Conventions.Remove<System.Data.Entity.Infrastructure.IncludeMetadataConvention>();

            modelBuilder.Entity<Results>().HasRequired(x => x.Solution).WithMany().WillCascadeOnDelete(true);

            base.OnModelCreating(modelBuilder);
        }
    }
}